Skip to content

[fix][client]Broker-side producer handle leak if closes a producer which state is regitering schema#25725

Merged
Technoboy- merged 1 commit intoapache:masterfrom
poorbarcode:fix/idle_producer_closes_when_registering_schema
May 9, 2026
Merged

[fix][client]Broker-side producer handle leak if closes a producer which state is regitering schema#25725
Technoboy- merged 1 commit intoapache:masterfrom
poorbarcode:fix/idle_producer_closes_when_registering_schema

Conversation

@poorbarcode
Copy link
Copy Markdown
Contributor

Motivation

If a producer is closed when its state is RegisteringSchema, it will not call removeProducer[1]. Eventually, it leads to a broker-side producer handle leak(Memory leak), and may cause such an error: Producer with name 'xxx' is already connected to topic. The issue will also lead to replicators being stuck.

You can reproduce the issue with the two new tests

    @Override
    public synchronized CompletableFuture<Void> closeAsync() {
        //...
        //...
        if (cnx == null || currentState != State.Ready) {
            log.info("[{}] [{}] Closed Producer (not connected)", topic, producerName);
            closeAndClearPendingMessages();
            return CompletableFuture.completedFuture(null); // (Highlight) it returns without remove producer from broker-side.
        }
        //...
        //...
}

Modifications

  • fix the issue

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

…ter a same producer if closes a producer which state is regitering schema
@poorbarcode poorbarcode added this to the 5.0.0-M1 milestone May 8, 2026
@poorbarcode poorbarcode self-assigned this May 8, 2026
@poorbarcode poorbarcode added type/bug The PR fixed a bug or issue reported a bug ready-to-test release/4.2.2 release/4.0.11 labels May 8, 2026
@Technoboy- Technoboy- merged commit 4f07667 into apache:master May 9, 2026
81 of 83 checks passed
@poorbarcode poorbarcode deleted the fix/idle_producer_closes_when_registering_schema branch May 9, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants